package conf

import (
	"encoding/json"
	"io/ioutil"
)

type Config struct {
	Ip       string `json:"ip"`       //ssh ip
	User     string `json:"user"`     //ssh user
	Password string `json:"password"` //ssh user
	Port     string `json:"port"`     //端口
}

var (
	GConfg *Config
)

func InitConfig(filename string) (err error) {
	var (
		content []byte
		conf    Config
	)

	if content, err = ioutil.ReadFile(filename); err != nil {
		return err
	}

	if err = json.Unmarshal(content, &conf); err != nil {
		return err
	}

	GConfg = &conf

	return

}
